(0) Obligation:

Clauses:

perm1([], []).
perm1(Xs, .(X, Ys)) :- ','(select(X, Xs, Zs), perm1(Zs, Ys)).
select(X, .(X, Xs), Xs).
select(X, .(Y, Xs), .(Y, Zs)) :- select(X, Xs, Zs).

Query: perm1(g,a)

(1) PrologToDTProblemTransformerProof (SOUND transformation)

Built DT problem from termination graph DT10.

(2) Obligation:

Triples:

selectB(X1, .(X2, X3), .(X2, X4)) :- selectB(X1, X3, X4).
perm1A(.(X1, X2), .(X1, X3)) :- perm1A(X2, X3).
perm1A(.(X1, X2), .(X3, X4)) :- selectB(X3, X2, X5).
perm1A(.(X1, X2), .(X3, X4)) :- ','(selectcB(X3, X2, X5), perm1A(.(X1, X5), X4)).

Clauses:

perm1cA([], []).
perm1cA(.(X1, X2), .(X1, X3)) :- perm1cA(X2, X3).
perm1cA(.(X1, X2), .(X3, X4)) :- ','(selectcB(X3, X2, X5), perm1cA(.(X1, X5), X4)).
selectcB(X1, .(X1, X2), X2).
selectcB(X1, .(X2, X3), .(X2, X4)) :- selectcB(X1, X3, X4).

Afs:

perm1A(x1, x2)  =  perm1A(x1)

(3) TriplesToPiDPProof (SOUND transformation)

We use the technique of [DT09]. With regard to the inferred argument filtering the predicates were used in the following modes:
perm1A_in: (b,f)
selectB_in: (f,b,f)
selectcB_in: (f,b,f)
Transforming TRIPLES into the following Term Rewriting System:
Pi DP problem:
The TRS P consists of the following rules:

PERM1A_IN_GA(.(X1, X2), .(X1, X3)) → U2_GA(X1, X2, X3, perm1A_in_ga(X2, X3))
PERM1A_IN_GA(.(X1, X2), .(X1, X3)) → PERM1A_IN_GA(X2, X3)
PERM1A_IN_GA(.(X1, X2), .(X3, X4)) → U3_GA(X1, X2, X3, X4, selectB_in_aga(X3, X2, X5))
PERM1A_IN_GA(.(X1, X2), .(X3, X4)) → SELECTB_IN_AGA(X3, X2, X5)
SELECTB_IN_AGA(X1, .(X2, X3), .(X2, X4)) → U1_AGA(X1, X2, X3, X4, selectB_in_aga(X1, X3, X4))
SELECTB_IN_AGA(X1, .(X2, X3), .(X2, X4)) → SELECTB_IN_AGA(X1, X3, X4)
PERM1A_IN_GA(.(X1, X2), .(X3, X4)) → U4_GA(X1, X2, X3, X4, selectcB_in_aga(X3, X2, X5))
U4_GA(X1, X2, X3, X4, selectcB_out_aga(X3, X2, X5)) → U5_GA(X1, X2, X3, X4, perm1A_in_ga(.(X1, X5), X4))
U4_GA(X1, X2, X3, X4, selectcB_out_aga(X3, X2, X5)) → PERM1A_IN_GA(.(X1, X5), X4)

The TRS R consists of the following rules:

selectcB_in_aga(X1, .(X1, X2), X2) → selectcB_out_aga(X1, .(X1, X2), X2)
selectcB_in_aga(X1, .(X2, X3), .(X2, X4)) → U10_aga(X1, X2, X3, X4, selectcB_in_aga(X1, X3, X4))
U10_aga(X1, X2, X3, X4, selectcB_out_aga(X1, X3, X4)) → selectcB_out_aga(X1, .(X2, X3), .(X2, X4))

The argument filtering Pi contains the following mapping:
perm1A_in_ga(x1, x2)  =  perm1A_in_ga(x1)
.(x1, x2)  =  .(x1, x2)
selectB_in_aga(x1, x2, x3)  =  selectB_in_aga(x2)
selectcB_in_aga(x1, x2, x3)  =  selectcB_in_aga(x2)
selectcB_out_aga(x1, x2, x3)  =  selectcB_out_aga(x1, x2, x3)
U10_aga(x1, x2, x3, x4, x5)  =  U10_aga(x2, x3, x5)
PERM1A_IN_GA(x1, x2)  =  PERM1A_IN_GA(x1)
U2_GA(x1, x2, x3, x4)  =  U2_GA(x1, x2, x4)
U3_GA(x1, x2, x3, x4, x5)  =  U3_GA(x1, x2, x5)
SELECTB_IN_AGA(x1, x2, x3)  =  SELECTB_IN_AGA(x2)
U1_AGA(x1, x2, x3, x4, x5)  =  U1_AGA(x2, x3, x5)
U4_GA(x1, x2, x3, x4, x5)  =  U4_GA(x1, x2, x5)
U5_GA(x1, x2, x3, x4, x5)  =  U5_GA(x1, x2, x5)

We have to consider all (P,R,Pi)-chains

Infinitary Constructor Rewriting Termination of PiDP implies Termination of TRIPLES

(4) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

PERM1A_IN_GA(.(X1, X2), .(X1, X3)) → U2_GA(X1, X2, X3, perm1A_in_ga(X2, X3))
PERM1A_IN_GA(.(X1, X2), .(X1, X3)) → PERM1A_IN_GA(X2, X3)
PERM1A_IN_GA(.(X1, X2), .(X3, X4)) → U3_GA(X1, X2, X3, X4, selectB_in_aga(X3, X2, X5))
PERM1A_IN_GA(.(X1, X2), .(X3, X4)) → SELECTB_IN_AGA(X3, X2, X5)
SELECTB_IN_AGA(X1, .(X2, X3), .(X2, X4)) → U1_AGA(X1, X2, X3, X4, selectB_in_aga(X1, X3, X4))
SELECTB_IN_AGA(X1, .(X2, X3), .(X2, X4)) → SELECTB_IN_AGA(X1, X3, X4)
PERM1A_IN_GA(.(X1, X2), .(X3, X4)) → U4_GA(X1, X2, X3, X4, selectcB_in_aga(X3, X2, X5))
U4_GA(X1, X2, X3, X4, selectcB_out_aga(X3, X2, X5)) → U5_GA(X1, X2, X3, X4, perm1A_in_ga(.(X1, X5), X4))
U4_GA(X1, X2, X3, X4, selectcB_out_aga(X3, X2, X5)) → PERM1A_IN_GA(.(X1, X5), X4)

The TRS R consists of the following rules:

selectcB_in_aga(X1, .(X1, X2), X2) → selectcB_out_aga(X1, .(X1, X2), X2)
selectcB_in_aga(X1, .(X2, X3), .(X2, X4)) → U10_aga(X1, X2, X3, X4, selectcB_in_aga(X1, X3, X4))
U10_aga(X1, X2, X3, X4, selectcB_out_aga(X1, X3, X4)) → selectcB_out_aga(X1, .(X2, X3), .(X2, X4))

The argument filtering Pi contains the following mapping:
perm1A_in_ga(x1, x2)  =  perm1A_in_ga(x1)
.(x1, x2)  =  .(x1, x2)
selectB_in_aga(x1, x2, x3)  =  selectB_in_aga(x2)
selectcB_in_aga(x1, x2, x3)  =  selectcB_in_aga(x2)
selectcB_out_aga(x1, x2, x3)  =  selectcB_out_aga(x1, x2, x3)
U10_aga(x1, x2, x3, x4, x5)  =  U10_aga(x2, x3, x5)
PERM1A_IN_GA(x1, x2)  =  PERM1A_IN_GA(x1)
U2_GA(x1, x2, x3, x4)  =  U2_GA(x1, x2, x4)
U3_GA(x1, x2, x3, x4, x5)  =  U3_GA(x1, x2, x5)
SELECTB_IN_AGA(x1, x2, x3)  =  SELECTB_IN_AGA(x2)
U1_AGA(x1, x2, x3, x4, x5)  =  U1_AGA(x2, x3, x5)
U4_GA(x1, x2, x3, x4, x5)  =  U4_GA(x1, x2, x5)
U5_GA(x1, x2, x3, x4, x5)  =  U5_GA(x1, x2, x5)

We have to consider all (P,R,Pi)-chains

(5) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 2 SCCs with 5 less nodes.

(6) Complex Obligation (AND)

(7) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

SELECTB_IN_AGA(X1, .(X2, X3), .(X2, X4)) → SELECTB_IN_AGA(X1, X3, X4)

The TRS R consists of the following rules:

selectcB_in_aga(X1, .(X1, X2), X2) → selectcB_out_aga(X1, .(X1, X2), X2)
selectcB_in_aga(X1, .(X2, X3), .(X2, X4)) → U10_aga(X1, X2, X3, X4, selectcB_in_aga(X1, X3, X4))
U10_aga(X1, X2, X3, X4, selectcB_out_aga(X1, X3, X4)) → selectcB_out_aga(X1, .(X2, X3), .(X2, X4))

The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
selectcB_in_aga(x1, x2, x3)  =  selectcB_in_aga(x2)
selectcB_out_aga(x1, x2, x3)  =  selectcB_out_aga(x1, x2, x3)
U10_aga(x1, x2, x3, x4, x5)  =  U10_aga(x2, x3, x5)
SELECTB_IN_AGA(x1, x2, x3)  =  SELECTB_IN_AGA(x2)

We have to consider all (P,R,Pi)-chains

(8) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(9) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

SELECTB_IN_AGA(X1, .(X2, X3), .(X2, X4)) → SELECTB_IN_AGA(X1, X3, X4)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
SELECTB_IN_AGA(x1, x2, x3)  =  SELECTB_IN_AGA(x2)

We have to consider all (P,R,Pi)-chains

(10) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(11) Obligation:

Q DP problem:
The TRS P consists of the following rules:

SELECTB_IN_AGA(.(X2, X3)) → SELECTB_IN_AGA(X3)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(12) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • SELECTB_IN_AGA(.(X2, X3)) → SELECTB_IN_AGA(X3)
    The graph contains the following edges 1 > 1

(13) YES

(14) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

PERM1A_IN_GA(.(X1, X2), .(X3, X4)) → U4_GA(X1, X2, X3, X4, selectcB_in_aga(X3, X2, X5))
U4_GA(X1, X2, X3, X4, selectcB_out_aga(X3, X2, X5)) → PERM1A_IN_GA(.(X1, X5), X4)
PERM1A_IN_GA(.(X1, X2), .(X1, X3)) → PERM1A_IN_GA(X2, X3)

The TRS R consists of the following rules:

selectcB_in_aga(X1, .(X1, X2), X2) → selectcB_out_aga(X1, .(X1, X2), X2)
selectcB_in_aga(X1, .(X2, X3), .(X2, X4)) → U10_aga(X1, X2, X3, X4, selectcB_in_aga(X1, X3, X4))
U10_aga(X1, X2, X3, X4, selectcB_out_aga(X1, X3, X4)) → selectcB_out_aga(X1, .(X2, X3), .(X2, X4))

The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
selectcB_in_aga(x1, x2, x3)  =  selectcB_in_aga(x2)
selectcB_out_aga(x1, x2, x3)  =  selectcB_out_aga(x1, x2, x3)
U10_aga(x1, x2, x3, x4, x5)  =  U10_aga(x2, x3, x5)
PERM1A_IN_GA(x1, x2)  =  PERM1A_IN_GA(x1)
U4_GA(x1, x2, x3, x4, x5)  =  U4_GA(x1, x2, x5)

We have to consider all (P,R,Pi)-chains

(15) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(16) Obligation:

Q DP problem:
The TRS P consists of the following rules:

PERM1A_IN_GA(.(X1, X2)) → U4_GA(X1, X2, selectcB_in_aga(X2))
U4_GA(X1, X2, selectcB_out_aga(X3, X2, X5)) → PERM1A_IN_GA(.(X1, X5))
PERM1A_IN_GA(.(X1, X2)) → PERM1A_IN_GA(X2)

The TRS R consists of the following rules:

selectcB_in_aga(.(X1, X2)) → selectcB_out_aga(X1, .(X1, X2), X2)
selectcB_in_aga(.(X2, X3)) → U10_aga(X2, X3, selectcB_in_aga(X3))
U10_aga(X2, X3, selectcB_out_aga(X1, X3, X4)) → selectcB_out_aga(X1, .(X2, X3), .(X2, X4))

The set Q consists of the following terms:

selectcB_in_aga(x0)
U10_aga(x0, x1, x2)

We have to consider all (P,Q,R)-chains.

(17) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04,JAR06].


The following pairs can be oriented strictly and are deleted.


PERM1A_IN_GA(.(X1, X2)) → PERM1A_IN_GA(X2)
The remaining pairs can at least be oriented weakly.
Used ordering: Polynomial interpretation [POLO]:

POL(.(x1, x2)) = 1 + x2   
POL(PERM1A_IN_GA(x1)) = 1 + x1   
POL(U10_aga(x1, x2, x3)) = 1 + x3   
POL(U4_GA(x1, x2, x3)) = 1 + x3   
POL(selectcB_in_aga(x1)) = 1 + x1   
POL(selectcB_out_aga(x1, x2, x3)) = 1 + x3   

The following usable rules [FROCOS05] with respect to the argument filtering of the ordering [JAR06] were oriented:

selectcB_in_aga(.(X1, X2)) → selectcB_out_aga(X1, .(X1, X2), X2)
selectcB_in_aga(.(X2, X3)) → U10_aga(X2, X3, selectcB_in_aga(X3))
U10_aga(X2, X3, selectcB_out_aga(X1, X3, X4)) → selectcB_out_aga(X1, .(X2, X3), .(X2, X4))

(18) Obligation:

Q DP problem:
The TRS P consists of the following rules:

PERM1A_IN_GA(.(X1, X2)) → U4_GA(X1, X2, selectcB_in_aga(X2))
U4_GA(X1, X2, selectcB_out_aga(X3, X2, X5)) → PERM1A_IN_GA(.(X1, X5))

The TRS R consists of the following rules:

selectcB_in_aga(.(X1, X2)) → selectcB_out_aga(X1, .(X1, X2), X2)
selectcB_in_aga(.(X2, X3)) → U10_aga(X2, X3, selectcB_in_aga(X3))
U10_aga(X2, X3, selectcB_out_aga(X1, X3, X4)) → selectcB_out_aga(X1, .(X2, X3), .(X2, X4))

The set Q consists of the following terms:

selectcB_in_aga(x0)
U10_aga(x0, x1, x2)

We have to consider all (P,Q,R)-chains.

(19) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04,JAR06].


The following pairs can be oriented strictly and are deleted.


PERM1A_IN_GA(.(X1, X2)) → U4_GA(X1, X2, selectcB_in_aga(X2))
The remaining pairs can at least be oriented weakly.
Used ordering: Polynomial interpretation [POLO]:

POL(.(x1, x2)) = 1 + x2   
POL(PERM1A_IN_GA(x1)) = x1   
POL(U10_aga(x1, x2, x3)) = 1 + x3   
POL(U4_GA(x1, x2, x3)) = x3   
POL(selectcB_in_aga(x1)) = x1   
POL(selectcB_out_aga(x1, x2, x3)) = 1 + x3   

The following usable rules [FROCOS05] with respect to the argument filtering of the ordering [JAR06] were oriented:

selectcB_in_aga(.(X1, X2)) → selectcB_out_aga(X1, .(X1, X2), X2)
selectcB_in_aga(.(X2, X3)) → U10_aga(X2, X3, selectcB_in_aga(X3))
U10_aga(X2, X3, selectcB_out_aga(X1, X3, X4)) → selectcB_out_aga(X1, .(X2, X3), .(X2, X4))

(20) Obligation:

Q DP problem:
The TRS P consists of the following rules:

U4_GA(X1, X2, selectcB_out_aga(X3, X2, X5)) → PERM1A_IN_GA(.(X1, X5))

The TRS R consists of the following rules:

selectcB_in_aga(.(X1, X2)) → selectcB_out_aga(X1, .(X1, X2), X2)
selectcB_in_aga(.(X2, X3)) → U10_aga(X2, X3, selectcB_in_aga(X3))
U10_aga(X2, X3, selectcB_out_aga(X1, X3, X4)) → selectcB_out_aga(X1, .(X2, X3), .(X2, X4))

The set Q consists of the following terms:

selectcB_in_aga(x0)
U10_aga(x0, x1, x2)

We have to consider all (P,Q,R)-chains.

(21) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 0 SCCs with 1 less node.

(22) TRUE